package com.marry.daodao.authserver.ui.security;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;

/**
 * @author mal
 * @date 2022-11-14 19:53
 */
@Configuration
public class JWTConfiguration {




    @Bean
    public TokenStore tokenStore() {
        return new JwtTokenStore(jwtAccessTokenConverter());
    }

    @Bean
    public JwtAccessTokenConverter jwtAccessTokenConverter() {
        JwtAccessTokenConverter converter = new MyJwtAccessTokenConverter();
        converter.setSigningKey("daodao");
        return converter;

    }

    @Bean
    public JWTTokenEnhancer jwtTokenEnhancer() {
        return new JWTTokenEnhancer();
    }


}
